/* This file is part of MyRename
 * Copyright (C) 2005-2009 Kai-Chieh Ku (kjackie@gmail.com)
 *
 * This program is free software; you can redistribute it and/or
 * modify it under the terms of the GNU General Public License
 * as published by the Free Software Foundation; either
 * version 3 of the License, or (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.	See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program; if not, write to the Free Software
 * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
 */

#pragma once

#define CTRPANWND (((CMyRenameDlg *)theApp.m_pMainWnd)->m_pCtrlwnd)

//CString& strchange(CString &dest, const CString &src, const bool isDir);

#include "XEditCtrl.h"

// CControlPanel dialog

class CControlPanel : public CDialog
{
	DECLARE_DYNAMIC(CControlPanel)
public:
	CControlPanel(CWnd* pParent = NULL);   // standard constructor
	virtual ~CControlPanel();

// Dialog Data
	enum { IDD = IDD_CTRPAN };

	virtual BOOL OnInitDialog();
protected:
	virtual void DoDataExchange(CDataExchange* pDX);    // DDX/DDV support
	virtual void DDV_MinMaxInt(CDataExchange* pDX, int &value, int minVal, int maxVal, int def = INT_MIN);

public:
	void Localize();

	/////////////////////////////////////////////////////
	// UI I/O
	/////////////////////////////////////////////////////

	int  GetFilenameMode();
	void SetFilenameMode(int nIDCheckButton);
	int  GetExtensionMode();
	void SetExtensionMode(int nIDCheckButton);
	int  GetCaseMode();
	void SetCaseMode(int nIDCheckButton);

	/////////////////////////////////////////////////////
	// controls
	/////////////////////////////////////////////////////

	CXEditCtrl m_xecFilename;
	CXEditCtrl m_xecExtension;
	CXEditCtrl m_xecNumStart;
	CXEditCtrl m_xecNumDiff;
	CXEditCtrl m_xecNumWidth;
	CXEditCtrl m_xecFind;
	CXEditCtrl m_xecReplace;
	CXEditCtrl m_xecMask;

	/////////////////////////////////////////////////////
	// convertions
	/////////////////////////////////////////////////////
public:
	CString& _strchange(CString &dist, const CString &src, const bool isDir);
	static CString& strchange(CString &dist, const CString &src, const bool isDir);
	void ConvStart();
	void DoRename();
	uint8 UndoAva();
	void DoUndo();

private:
	bool m_bIsRenaming;
	int m_iStart;
	int m_iDiff;
	int m_iWidth;
	CWnd  *m_wndParent;

	DECLARE_MESSAGE_MAP()
public:
	afx_msg void OnBnClickedFn();
	afx_msg void OnBnClickedExt();
	afx_msg void OnBnClickedCase();
protected:
	virtual BOOL OnCommand(WPARAM wParam, LPARAM lParam);
public:
	afx_msg void OnBnClickedButtonApply();
};
